(begin

(define g (graph-new (* 3.5 72) (* 4 72)))
(define plotw 2.)
(define ploth 3.)
(define bgc (color-rgb 240. 240. 240.))

(define (draw-dataline data color idx)
  (graph-color g color)
  (graph-moveto g (car (car data)) (cadr (car data)))
  (for-each (lambda (s) (let ((x (car s))
                              (y (list-ref s idx)))
        (graph-lineto g x y))) data)
  (graph-stroke g)
  (for-each (lambda (s) (let ((x (car s))
                              (y (list-ref s idx)))
        (graph-solidcircle g x y 6.))) data)
)

(define blue '( (0  61  61 61) (0.11 83 72 71) (0.25 90 83 81) 
                (0.43 96 92 88) (0.66 100 98 94) (1.  100 100 99)))
(define green '( (0.  79 81) (0.111 86 85) (0.333 92 88) 
                 (0.538 96 93) (0.81 99) (1.  100 99)))

(graph-aorigin g 1. 0.7)
(graph-font g "Helvetica" 12)
(graph-linearstyle g 4 0 5 1 5)
(graph-xlinear g plotw 0. 1. 0. .20 1)
(graph-ylinear g ploth 60. 100. 0.0 5. 2)
(graph-color g bgc) (graph-solidbox g 0. 60. 1. 100.)
(draw-dataline green DarkGreen 1)
(draw-dataline blue DarkBlue 3)
(graph-color g Black)
(graph-xaxis g)
(graph-yaxis g)
(graph-xlabel g "Color/Clear Ratio")
(graph-ylabel g "SpO2 [%]")
(graph-htextright g .75 63.5 "Green Dye")
(graph-htextright g .75 66.5 "Blue Dye")
(graph-color g DarkGreen) (graph-solidcircle g .85 63.5 6.)
(graph-color g DarkBlue) (graph-solidcircle g .85 66.5 6.)

g)
